package Java9_11;

import java.util.*;

public class Work1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Map<Character, Integer> map = new HashMap<>();
        System.out.println("请输如字符：");
        String s = sc.next();
        char[] a = s.toCharArray();
        int count = 0;
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                if (a[i] == a[j]) {
                    count++;
                }
            }
            map.put(a[i], count);
             count=0;
        }
        Set set = map.keySet();
        Iterator ir = set.iterator();
        while (ir.hasNext()) {
            Object key = ir.next();
            Integer value = map.get(key);
            System.out.println(key + "   " + value);
        }
    }
}
